var app = getApp();
Page({

  data: {
    UserImage: '',
    Username: '',
    map_width: 300,
    map_height: 600
  },

  onLoad: function (options) {
  },
  formSubmit:function(e){
    wx.login({
      success:function(res){
          if(res.code){
             wx.request({
               url: 'https://my-weixin.tunnel.qydev.com/wechat/user/login',
               data:{
                 code:res.code
               },
               header: {
                 'content-type': 'application/json' // 默认值
               },
               success: function (res) {
                 console.log(res.data)
                 wx.setStorage({
                   key: 'sessionKey',
                   data: res.data.sessionKey,
                 })
               }
             })
          }
      },
      fail:function(res){

      },
      complete:function(res){

      }
    })
   
    console.log('form发生了submit事件，携带数据为：', e.detail.value)
  },
  formReset:function(e){
    console.log('form发生了reset事件')
  }

})